import type { BodyOptions, QueryOptions } from './global.d';

import { http } from './request/index';

export const Apis = {
  /** 登录注册 captchaImage */
  get_captchaImage: (data?: QueryOptions) => http.get('/captchaImage', data),
  /** 登录注册 login */
  post_login: (data?: BodyOptions) => http.post('/login', data),
  /** 登录注册 getInfo */
  get_getInfo: (data?: QueryOptions) => http.get('/getInfo', data),
  /** 菜单 getRouters */
  get_getRouters: (data?: QueryOptions) => http.get('/getRouters', data),
  system: {
    user: {
      /** 部门 deptTree */
      get_deptTree: (data?: QueryOptions) =>
        http.get('/system/user/deptTree', data),
      /** 用户 getPage */
      get_list: (data?: QueryOptions) => http.get('/system/user/list', data),
      /** 用户 importTemplate */
      post_importTemplate: (data?: BodyOptions) =>
        http.post('/system/user/importTemplate', data),
      /** 用户 changeStatus */
      put_changeStatus: (data?: BodyOptions) =>
        http.put('/system/user/changeStatus', data),
    },
    dict: {
      data: {
        /** 字典 getDictDataByType */
        get_type: (data?: QueryOptions) =>
          http.get('/system/dict/data/type/{dictType}', data),
      },
    },
    config: {
      /** 配置 getConfigKey */
      get_configKey: (data?: QueryOptions) =>
        http.get('/system/config/configKey/{configKey}', data),
    },
    /** 用户 getOne */
    get_user: (data?: QueryOptions) => http.get('/system/user/{userId}', data),
    menu: {
      /** 菜单 getList */
      get_list: (data?: QueryOptions) => http.get('/system/menu/list', data),
    },
  },
};
